'use strict'
function reduce01() {
    var arr = [1, 3, 5, 7, 9];
    arr.reduce(function (x, y) {
        return x + y;
    });
}

// console.log(reduce01());
var s = [1, 3, 4, 6, 8, 12];
function stringtoint(s) {
    var arr = [...s];
    function toInt(zm) {
        return +zm;
    }
    var res = arr.map(toInt);
    return res.reduce(function (x, y) {
        return x * 10 + y
    })
}
//将一个整数拆分成  数组
function string2int(s1) {
    var array = [];
    var result = 0;
    for (var i of s) {
        i = i - 0;
        array.push(i);
    }
    console.log('array=' + array);
}
//将每个英文名字首字母大写，其余小写
function normalize(arr) {
    var a = arr.map(function (str) {
        var up;
        var low;
        var res;
        up = str.toUpperCase();
        low = str.toLowerCase();
        res = up[0]+low.substring(1);
        return res;
    })
    return a;
}
//将字符串变成整数
function inttostring(){
    var arr = ['1','2','3'];
    var r;
    r = arr.map(function(x){
        return parseInt(x);
    })
    console.log(r);
}

inttostring();
//console.log(normalize(['adam', 'LISA', 'barT']).toString());
//console.log(string2int(s));
// console.log(stringtoint(s));